package com.cyf.filmDownload.film.entity;

import com.cyf.filmDownload.common.util.CollUtil;
import lombok.Data;

import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;


@Data
public class DownloadResult {
    private String filmName;
    // 1:电影  2：电视剧
    private Integer type;
    private Integer filmCount;
    private List<FilmDetail> filmDetails;

    public void setFilmDetails(List<FilmDetail> filmDetails) {
        this.filmDetails = filmDetails;
        if (CollUtil.isEmpty(filmDetails)) {
            return;
        }
        Set<Integer> list = filmDetails.stream().map(FilmDetail::getFilmIndex).collect(Collectors.toSet());
        filmCount = list.size();
    }
}
